package gateway.config;

import org.springframework.cloud.gateway.route.RouteLocator;
import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author cyt
 * @create 2020-05-21 17:12
 */

@Configuration
public class GatewayConfig {

    @Bean
    public RouteLocator my(RouteLocatorBuilder routeLocatorBuilder) {

        RouteLocatorBuilder.Builder routes = routeLocatorBuilder.routes();
        routes.route("my", r -> r.path("/baidu").uri("http://baike.baidu.com/item/Spring%20Boot/20249767?fr=aladdin")).build();
        RouteLocator build = routes.build();
        return build;
    }

}
